package com.dragon.repository.domain.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.DoReminder;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DoReminderDTO {

    private static final long serialVersionUID = 1L;

    private Integer id;

    @ApiModelProperty(value = "标题")
    private String title;

    @ApiModelProperty(value = "提醒类型")
    private Integer type;

    @ApiModelProperty(value = "关联id")
    private Integer corrlelationId;

    @ApiModelProperty(value = "访问地址")
    private String urlAddress;

    @ApiModelProperty(value = "发送人id")
    private String fromId;

    @ApiModelProperty(value = "流程类型")
    private Integer operationType;

    @ApiModelProperty(value = "提醒人id")
    private Integer adminId;

    @ApiModelProperty(value = "0未读，1已读")
    private Integer status;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "发起人名称")
    private String userName;


    public DoReminderDTO() {}

    public DoReminderDTO(DoReminder entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static DoReminderDTO convert(DoReminder entity) {
        return new DoReminderDTO(entity);
    }

    public static List<DoReminderDTO> convertList(List<DoReminder> list) {
        List<DoReminderDTO> resultList = new ArrayList<>();
        for (DoReminder entity : list) {
            resultList.add(new DoReminderDTO(entity));
        }
        return resultList;
    }}
